#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
    chdir("/home/liusong");
    FILE* f = fopen("./log.txt","w");
    if(f==NULL)
    {
        perror("fopen");
        exit(1);
    }
    
    const char* ptr = "liusong\n";
    int count = 5;
    while(count--)
    {
        int n = fwrite(ptr,strlen(ptr),1,f); 
        printf("write:%dblock pid:%d\n",n,getpid());
        sleep(10);
    }
    fclose(f);
    return 0;
}
